package com.siwei.mes.enums;

import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;

import java.util.Arrays;

/**
 * @Description: 物料类型枚举   字典表（MASTERIAL_TYPE）
 * @Version: 1.0
 * @author: chenmaolin
 * @date: 2023/12/23 22:16
 */
@Getter
public enum CementEnum {
    KJ(1, "快检", "CEMENT_PARAM_KJ"),
    BZCD(2, "标准稠度", "CEMENT_PARAM_BZCD"),
    NJSJ(3, "凝结时间", "CEMENT_PARAM_NJSJ"),
    ADX(4, "安定性", "CEMENT_PARAM_ADX"),
    QDCD(5, "强度测定", "CEMENT_PARAM_QDCD"),
    LDX(6, "流动性", "CEMENT_PARAM_LDX"),
    XD(7, "细度", "CEMENT_PARAM_XD"),
    MD(8, "密度", "CEMENT_PARAM_MD"),
    BBMJ(9, "比表面积", "CEMENT_PARAM_BBMJ");

    @ApiModelProperty(value = "类型id")
    private Integer code;

    @ApiModelProperty(value = "水泥试验项目名称")
    private String name;

    @ApiModelProperty(value = "水泥试验项目类型")
    private String testProjectType;

    CementEnum(Integer code, String name, String testProjectType) {
        this.code = code;
        this.name = name;
        this.testProjectType = testProjectType;
    }

    /**
     * 根据code查找信息
     *
     * @param code 物料类型
     * @return
     */
    public static CementEnum selectByCode(Integer code) {
        return Arrays.stream(values()).filter(e -> e.getCode().equals(code)).findFirst().orElse(null);
    }
}
